package com.qf.pojo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

import java.util.Date;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class User implements CheckNull {

  private Long uId;
  private String username;
  private String password;
  private String pwdSalt;
  private String name;
  private String phone;
  private String email;
  private Long sex;
  private String avator;
  private String info;
  private Long type;
  private Long status;
  private Date currentLogin;
  private Date lastLogin;
  private String currentLoginIp;
  private String lastLoginIp;
  private Date createTime;
  private String createBy;
  private Date updateTime;
  private String updateBy;
  private String remark;


  public boolean isEmpty(CheckType type) {
    switch (type){
      case ADD:
        return !StringUtils.hasText(username)
                ||!StringUtils.hasText(password)
                ||!StringUtils.hasText(name)
                ||!StringUtils.hasText(phone)
                ||!StringUtils.hasText(email)
                ||ObjectUtils.isEmpty(sex)||sex<0;

    }
    return CheckNull.super.isEmpty(type);
  }
}
